<%-- 
  - Author: Mohtisham Salahria
  - Date: 10-April-2011
  - Copyright Notice: TRAKHEES
  - Description: form.jsp
 --%>

<%@ include file="/WEB-INF/view/include.jsp"%>
<%@ page import="ae.pcfc.etks.online.web.*"%>

<script type="text/javascript">
	$()
			.ready(
					function() {

						//$( "input:submit, input:reset, input:button, input:file, .view").button();

						$("#AdminPersonApprove")
								.validate(
										{
											onfocusout : false,
											onkeyup : false,
											//onclick: false,			
											rules : {
												strActionType : "required",
												strComments : "required"
											},

											showErrors : function(errorMap,
													errorList) {

												var errors = '<ul>';
												var label;
												if (errorList.length) {
													$.each(errorMap, function(
															name, value) {
														label = $(
																"label[for='"
																		+ name
																		+ "']")
																.html();
														label = value + '['
																+ label + ']';
														errors = errors
																+ '<li>'
																+ label
																+ '</li>';

													});
													errors = errors + '</ul>';
													jAlert('error', errors,
															'<spring:message code="label.errormessage" />');
												}
											}

										});
						$("input[name='close']").click(function() {

							window.open("", "_self", null);
							window.close();

						});
					});

	$(function() {
		$("#accordion").accordion();
	});
</script>

<div id="container" dir='<spring:message code="page.dir"/>'
	align='<spring:message code="page.align"/>'>

	<form:form name="PersonInfo" id="PersonInfo" method="POST"
		modelAttribute="<%=ConstantsAdmin.CLIENT_PERSON_REGISTER_ADMIN_REVIEW_USER_DATA_REQUEST_MODEL_KEY %>">
		<spring:hasBindErrors
			name="<%=ConstantsAdmin.CLIENT_PERSON_REGISTER_ADMIN_REVIEW_USER_DATA_REQUEST_MODEL_KEY %>">
			<script type="text/javascript">
				$(document)
						.ready(
								function() {
									jAlert(
											'error',
											'<li><form:errors path="*" delimiter="<li>"/>',
											'<spring:message code="label.errormessage" />');
								});
			</script>
		</spring:hasBindErrors>
		<div id=accordion>
			<div
				class="ui-jqgrid-titlebar ui-widget-header ui-corner-top ui-helper-clearfix">
				<spring:message code="label.client.summary.info" />
			</div>
			<div class="ui-widget_content_c t_fin-black-txt">
				<fieldset>
					<legend>
						<spring:message
							code="label.nonclient.person.register.personal.details" />
					</legend>
				</fieldset>
				<div class="t_form-left">
					<div class="fm-req">
						<label> <spring:message
								code="label.nonclient.person.register.nameENG" /> </label>
						<c:out value="${clientPersonSummary.strNameENG}"></c:out>
					</div>
					<div style="clear: both"></div>
					<div class="fm-req">
						<label> <spring:message
								code="label.nonclient.person.register.nameARB" /> </label>
						<c:out value="${clientPersonSummary.strNameARB}"></c:out>
						<br />
					</div>
					<div style="clear: both"></div>
					<div>
						<label> <spring:message
								code="label.nonclient.person.register.telNoHome" /> </label>
						<c:out value="${clientPersonSummary.strHomeTel}"></c:out>
						<br />
					</div>
					<div style="clear: both"></div>
					<div class="fm-req">
						<label> <spring:message code="label.company.role" /> </label>
						<div style="display: block;" class="float">
							<c:forEach items="${clientPersonSummary.SCClientPersonRoleVO}"
								var="clientRole" varStatus="loop">
								<c:if test="${loop.index > 0 }">
									<c:out value=""></c:out>
								</c:if>
								<c:choose>
									<c:when
										test='${requestScope.requestContextAttribute.locale.language == "ar"}'>
										<c:out value="${clientRole.clientRoleArb}"></c:out>
										<br />
									</c:when>
									<c:otherwise>
										<c:out value="${clientRole.clientRoleEng}"></c:out>
										<br />
									</c:otherwise>
								</c:choose>
							</c:forEach>
						</div>
					</div>
					<div style="clear: both"></div>
					<div class="fm-req">
						<label> <spring:message
								code="label.nonclient.person.register.mobNo1" /> </label>
						<c:out value="${clientPersonSummary.strMobile1}"></c:out>
					</div>
					<div style="clear: both"></div>
					<div>
						<label> <spring:message
								code="label.nonclient.person.register.emailAddress" /> </label>
						<c:out value="${clientPersonSummary.strEmail}"></c:out>
					</div>
					<div style="clear: both"></div>
					<div>
						<label> <spring:message
								code="label.nonclient.person.register.websiteURL" /> </label>
						<c:out value="${clientPersonSummary.strWebsite}"></c:out>
					</div>
					<div style="clear: both"></div>
				</div>
			</div>
			<div style="clear: both"></div>
			<fieldset>
				<legend>
					<spring:message code="label.login.details" />
				</legend>
			</fieldset>
			<div style="clear: both"></div>
			<br />
			<div class="t_form-left">


				<div class="fm-req">
					<form:label path="strUserName">
						<spring:message code="label.username" />
					</form:label>
					<c:out
						value="${clientPersonRegisterAdminReviewUserData.strUserName}" />
					<br />
				</div>
				<div style="clear: both"></div>
				<div>
					<form:label path="strEmailAddress">
						<spring:message code="label.emailaddress" />
					</form:label>
					<c:out
						value="${clientPersonRegisterAdminReviewUserData.strEmailAddress}" />
					<br />
				</div>
				<div style="clear: both"></div>
				<div class="fm-req">
					<form:label path="strMobileNo">
						<spring:message code="label.mobilenumber" />
					</form:label>
					<c:out
						value="${clientPersonRegisterAdminReviewUserData.strMobileNo}" />
					<br />
				</div>
				<div style="clear: both"></div>
				<div class="fm-req" style="display: none;">
					<form:label path="strMobileNotification">
						<spring:message code="label.company.notification" />
					</form:label>
					<c:if
						test="${clientPersonRegisterAdminReviewUserData.strMobileNotification == 'Y'}">
						<spring:message code="label.smsnotification" />
					</c:if>
					<c:if
						test="${clientPersonRegisterAdminReviewUserData.strEmailNotification == 'Y' }">
						<spring:message code="label.emailnotification" />
					</c:if>
					<br />
				</div>

			</div>
			<!--<div style="clear:both"></div>
	-->
			<fieldset>
				<legend>
					<spring:message
						code="label.nonclient.person.register.documents.details" />
				</legend>
			</fieldset>
			<div style="clear: both"></div>
			<br />
			<div class="t_form-left">
				<div class="fm-req">
					<form:label path="strUploadURL">
						<spring:message code="label.person.emiratesid" />
					</form:label>
					<c:forEach items="${adminActionHistory.uploadDocumentVOs}"
						var="docs" varStatus="loop">
						<a href="file/download.htm?fileId=${docs.lFileId}" class="view"><spring:message
								code="label.user.request.view" />
						</a>
						<br />
					</c:forEach>
				</div>
			</div>
			<div style="clear: both"></div>
			<fieldset>
				<legend>
					<spring:message code="label.actionhistory" />
				</legend>
			</fieldset>
			<div style="clear: both"></div>
			<br />
			<div class="t_fin-black-txt">
				<table style="width: 100%" class="t_grid-table">
					<tr class="odd ui-jqgrid-labels">
						<td class="ui-state-default ui-th-column ui-th-ltr"><spring:message
								code="label.nonclient.person.register.action.date" />
						</td>
						<td class="ui-state-default ui-th-column ui-th-ltr"><spring:message
								code="label.nonclient.person.register.action.user" />
						</td>
						<td class="ui-state-default ui-th-column ui-th-ltr"><spring:message
								code="label.nonclient.person.register.action.type" />
						</td>
						<td class="ui-state-default ui-th-column ui-th-ltr"><spring:message
								code="label.department" />
						</td>
						<td class="ui-state-default ui-th-column ui-th-ltr"><spring:message
								code="label.nonclient.person.register.action.comments" />
						</td>
						<td class="ui-state-default ui-th-column ui-th-ltr"><spring:message
								code="label.register.user.notification" />
						</td>
					</tr>
					<c:choose>
						<c:when test="${empty adminActionHistory.stepActionVOs}">
							<tr>
								<td colspan="6" align="center"><spring:message
										code="msg.no.actions.found" /></td>
							</tr>
						</c:when>
						<c:otherwise>
							<c:forEach items="${adminActionHistory.stepActionVOs}"
								var="actions" varStatus="loop">
								<tr>
									<td><fmt:formatDate pattern="dd/MM/yyyy"
											value="${actions.actionDate}" />
									</td>
									<td><c:out value="${actions.strActionUser}"></c:out>
									</td>
									<td><c:choose>
											<c:when test="${actions.strActionType == 'I' }">
												<spring:message code="msg.workflow.status.in.progress" />
											</c:when>
											<c:when test="${actions.strActionType == 'A' }">
												<spring:message code="msg.workflow.status.approved" />
											</c:when>
											<c:when test="${actions.strActionType == 'R' }">
												<spring:message code="msg.workflow.status.rejected" />
											</c:when>
										</c:choose></td>
									<c:forEach items="${adminActionHistory.commentsVOs}"
										var="comments" varStatus="commentloop">
										<c:if
											test="${actions.processStep.processStepCode == comments.processStep.processStepCode}">
											<c:if
												test="${registerAdminReview.strStepName ==  comments.processStep.processStepCode}">
												<c:set property="strApplnStatus"
													target="${adminActionHistory}" value="DEPT_ACTED"></c:set>
											</c:if>
											<c:choose>
												<c:when
													test='${requestScope.requestContextAttribute.locale.language == "ar"}'>
													<td><c:out
															value="${comments.processStep.processStepDescAr}"></c:out>
													</td>
												</c:when>
												<c:otherwise>
													<td><c:out
															value="${comments.processStep.processStepDescEn}"></c:out>
													</td>
												</c:otherwise>
											</c:choose>
											<td><c:out value="${comments.strComments}"></c:out>
											</td>
											<td><c:out value="${comments.strCommentsUser}"></c:out>
											</td>
										</c:if>
									</c:forEach>
								</tr>
							</c:forEach>
						</c:otherwise>
					</c:choose>
				</table>
			</div>
			<div style="clear: both"></div>
			<br />
		</div>


	</form:form>
	<div style="clear: both">
		<br />
	</div>
	<div class="fm-req">
		<label><b><spring:message
					code="client.register.application.status" />
		</b>
		</label>
		<c:choose>
			<c:when
				test='${requestScope.requestContextAttribute.locale.language == "ar"}'>
				<c:out value="${adminActionHistory.strStatusAr}" />
			</c:when>
			<c:otherwise>
				<c:out value="${adminActionHistory.strStatusEn}" />
			</c:otherwise>
		</c:choose>
	</div>
</div>
